home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / umountroot < prev    next >
Encoding:
Text File  |  2006-10-06  |  1.1 KB  |  49 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          umountroot
  4. # Required-Start:    umountfs
  5. # Required-Stop:     umountfs
  6. # Default-Start:     6
  7. # Default-Stop:
  8. # Short-Description: Mount the root filesystem read-only.
  9. ### END INIT INFO
  10.  
  11. PATH=/sbin:/bin
  12. . /lib/init/vars.sh
  13.  
  14. . /lib/lsb/init-functions
  15.  
  16. do_stop () {
  17.     [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
  18.     MOUNT_FORCE_OPT=
  19.     [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
  20.     # This:
  21.     #     mount -n -o remount,ro /
  22.     # will act on a bind mount of / if there is one.
  23.     # See #339023 and the comment in checkroot.sh
  24.     mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
  25.     || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev / 2>/dev/null \
  26.     || mount $MOUNT_FORCE_OPT -n -o remount,ro                       /
  27.     ES=$?
  28.     [ "$VERBOSE" = no ] || log_action_end_msg $ES
  29. }
  30.  
  31. case "$1" in
  32.   start)
  33.     # No-op
  34.     ;;
  35.   restart|reload|force-reload)
  36.     echo "Error: argument '$1' not supported" >&2
  37.     exit 3
  38.     ;;
  39.   stop)
  40.     do_stop
  41.     ;;
  42.   *)
  43.     echo "Usage: $0 start|stop" >&2
  44.     exit 3
  45.     ;;
  46. esac
  47.  
  48. :
  49.